package cn.stylefeng.guns.modular.business.frequency.orderfinishrecorddetail.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import cn.stylefeng.guns.modular.business.frequency.orderfinishrecorddetail.service.OrderFinishRecordDetailService;
import cn.stylefeng.guns.modular.business.frequency.orderfinishrecorddetail.model.param.OrderFinishRecordDetailParam;

import javax.annotation.Resource;

/**
 * 订单交付记录详情表 控制器
 *
 * @author: yujie
 * @date: 2023/05/30 18:11
 */
@RestController
public class OrderFinishRecordDetailController {

    @Resource
    private OrderFinishRecordDetailService orderFinishRecordDetailService;

    /**
     * 分页查询订单交付记录详情表
     *
     * @author yujie
     * @date 2023/05/30 18:11
     */
    @GetMapping("/orderFinishRecordDetail/page")
    @BusinessLog(title = "订单交付记录详情表_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(OrderFinishRecordDetailParam orderFinishRecordDetailParam) {
        return new SuccessResponseData(orderFinishRecordDetailService.page(orderFinishRecordDetailParam));
    }

    /**
     * 获取全部订单交付记录详情表
     *
     * @author yujie
     * @date 2023/05/30 18:11
     */
    @GetMapping("/orderFinishRecordDetail/list")
    @BusinessLog(title = "订单交付记录详情表_查询所有", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list(OrderFinishRecordDetailParam orderFinishRecordDetailParam) {
        return new SuccessResponseData(orderFinishRecordDetailService.list(orderFinishRecordDetailParam));
    }

    /**
     * 查看详情订单交付记录详情表
     *
     * @author yujie
     * @date 2023/05/30 18:11
     */
    @GetMapping("/orderFinishRecordDetail/detail")
    @BusinessLog(title = "订单交付记录详情表_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(OrderFinishRecordDetailParam.detail.class) OrderFinishRecordDetailParam orderFinishRecordDetailParam) {
        return new SuccessResponseData(orderFinishRecordDetailService.detail(orderFinishRecordDetailParam));
    }

    /**
     * 添加订单交付记录详情表
     *
     * @author yujie
     * @date 2023/05/30 18:11
     */
    @PostMapping("/orderFinishRecordDetail/add")
    @BusinessLog(title = "订单交付记录详情表_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(OrderFinishRecordDetailParam.add.class) OrderFinishRecordDetailParam orderFinishRecordDetailParam) {
        orderFinishRecordDetailService.add(orderFinishRecordDetailParam);
        return new SuccessResponseData();
    }

    /**
     * 删除订单交付记录详情表
     *
     * @author yujie
     * @date 2023/05/30 18:11
     */
    @PostMapping("/orderFinishRecordDetail/delete")
    @BusinessLog(title = "订单交付记录详情表_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(OrderFinishRecordDetailParam.delete.class) OrderFinishRecordDetailParam orderFinishRecordDetailParam) {
        orderFinishRecordDetailService.delete(orderFinishRecordDetailParam);
        return new SuccessResponseData();
    }

    /**
     * 编辑订单交付记录详情表
     *
     * @author yujie
     * @date 2023/05/30 18:11
     */
    @PostMapping("/orderFinishRecordDetail/edit")
    @BusinessLog(title = "订单交付记录详情表_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(OrderFinishRecordDetailParam.edit.class) OrderFinishRecordDetailParam orderFinishRecordDetailParam) {
        orderFinishRecordDetailService.edit(orderFinishRecordDetailParam);
        return new SuccessResponseData();
    }


}
